bitkeeper revision 1.630 (3fbf4c5eGi95ZU5mjOHJ4L6ioUNlKA)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Sat, 22 Nov 2003 11:45:34 +0000 (11:45 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Sat, 22 Nov 2003 11:45:34 +0000 (11:45 +0000)
stopdom.py:
  Rename: tools/examples/xi_stopdom.py -> tools/examples/stopdom.py
destroydom.py:
  Rename: tools/examples/xi_destroydom.py -> tools/examples/destroydom.py
listdoms.py:
  Rename: tools/examples/xi_listdoms.py -> tools/examples/listdoms.py
createlinuxdom.py:
  Rename: tools/examples/xi_createlinuxdom.py -> tools/examples/createlinuxdom.py

.rootkeys
tools/examples/createlinuxdom.py [new file with mode: 0755]
tools/examples/destroydom.py [new file with mode: 0644]
tools/examples/listdoms.py [new file with mode: 0644]
tools/examples/stopdom.py [new file with mode: 0644]
tools/examples/xi_createlinuxdom.py [deleted file]
tools/examples/xi_destroydom.py [deleted file]
tools/examples/xi_listdoms.py [deleted file]
tools/examples/xi_stopdom.py [deleted file]

index 3405ed95a0d97f1c96fb158659b7e7a4e1d283ab..4e135eadd2b60cda9cd54236f2594fa16082fb23 100644 (file)
--- a/.rootkeys
+++ b/.rootkeys
 3e6377b24eQqYMsDi9XrFkIgTzZ47A tools/balloon/Makefile
 3e6377d6eiFjF1hHIS6JEIOFk62xSA tools/balloon/README
 3e6377dbGcgnisKw16DPCaND7oGO3Q tools/balloon/balloon.c
-3fbe2f12OPAkzIUtumU3wRAihnhocQ tools/examples/xi_createlinuxdom.py
-3fbe2f12dZbmXLlgQdMgkmnSUj23AQ tools/examples/xi_destroydom.py
-3fbe2f12ltvweb13kBSsxqzZDAq4sg tools/examples/xi_listdoms.py
-3fbe2f12Bnt8mwmr1ZCP6HWGS6yvYw tools/examples/xi_stopdom.py
+3fbe2f12OPAkzIUtumU3wRAihnhocQ tools/examples/createlinuxdom.py
+3fbe2f12dZbmXLlgQdMgkmnSUj23AQ tools/examples/destroydom.py
+3fbe2f12ltvweb13kBSsxqzZDAq4sg tools/examples/listdoms.py
+3fbe2f12Bnt8mwmr1ZCP6HWGS6yvYw tools/examples/stopdom.py
 3f776bd2Xd-dUcPKlPN2vG89VGtfvQ tools/misc/Makefile
 3f6dc136ZKOjd8PIqLbFBl_v-rnkGg tools/misc/miniterm/Makefile
 3f6dc140C8tAeBfroAF24VrmCS4v_w tools/misc/miniterm/README
diff --git a/tools/examples/createlinuxdom.py b/tools/examples/createlinuxdom.py
new file mode 100755 (executable)
index 0000000..2e25e30
--- /dev/null
@@ -0,0 +1,101 @@
+#!/usr/bin/env python
+
+#
+# Example script for creating and building a new Linux guest OS for Xen.
+#
+
+import Xc, XenoUtil, sys, os
+
+# Variable declaration. Set these up properly later on, as needed.
+nfsserv = nfspath = root_partn = usr_partn = ""
+
+# STEP 1. Specify kernel image file.
+image = "FULL_PATH_TO_IMAGE"
+
+# STEP 2. Specify IP address, netmask and gateway for the new domain.
+ipaddr  = "ADDRESS"
+netmask = XenoUtil.get_current_ipmask()
+gateway = XenoUtil.get_current_ipgw()
+
+# STEP 3a. Specify NFS server and path to rootfs (only needed for network boot)
+nfsserv = "ADDRESS"
+nfspath = "FULL_PATH_TO_ROOT_DIR"
+
+# STEP 3b. Specify root (and possibly /usr) on local disc (if not NFS booting)
+#root_partn = "/dev/sda2"
+#usr_partn  = "/dev/sda6"
+
+# STEP 4. Check that the following cmdline setup is to your taste.
+cmdline = "ip="+ipaddr+":"+nfsserv+":"+gateway+":"+netmask+"::eth0:off"
+if root_partn:
+    # Boot from local disc. May specify a separate /usr.
+    cmdline = cmdline + " root="+root_partn+" ro"
+    if usr_partn:
+        " usr="+usr_partn
+elif nfsserv:
+    # NFS boot
+    cmdline = cmdline + " root=/dev/nfs"
+    cmdline = cmdline + " nfsroot="+nfspath
+
+if root_partn:
+    root_info = XenoUtil.lookup_blkdev_partn_info(root_partn)
+    if not root_info:
+        print "Could not obtain info on partition '" + root_partn + "'"
+        sys.exit()
+
+if usr_partn:
+    usr_info = XenoUtil.lookup_blkdev_partn_info(usr_partn)
+    if not usr_info:
+        print "Could not obtain info on partition '" + usr_partn + "'"
+        sys.exit()
+
+if not os.path.isfile( image ):
+    print "Image file '" + image + "' does not exist"
+    sys.exit()
+
+xc = Xc.new()
+
+id = xc.domain_create()
+if id <= 0:
+    print "Error creating domain"
+    sys.exit()
+
+if xc.linux_build( dom=id, image=image, cmdline=cmdline ):
+    print "Error building Linux guest OS"
+    xc.domain_destroy ( dom=id )
+    sys.exit()
+
+if root_partn:
+    if xc.vbd_create( dom=id, vbd=root_info[0], writeable=1 ):
+        print "Error creating root VBD"
+        xc.domain_destroy ( dom=id )
+        sys.exit()
+    if xc.vbd_add_extent( dom=id,
+                          vbd=root_info[0],
+                          device=root_info[1],
+                          start_sector=root_info[2],
+                          nr_sectors=root_info[3] ):
+        print "Error populating root VBD"
+        xc.domain_destroy ( dom=id )
+        sys.exit()
+
+if usr_partn:
+    if xc.vbd_create( dom=id, vbd=usr_info[0], writeable=0 ):
+        print "Error creating usr VBD"
+        xc.domain_destroy ( dom=id )
+        sys.exit()
+    if xc.vbd_add_extent( dom=id,
+                          vbd=usr_info[0],
+                          device=usr_info[1],
+                          start_sector=usr_info[2],
+                          nr_sectors=usr_info[3] ):
+        print "Error populating usr VBD"
+        xc.domain_destroy ( dom=id )
+        sys.exit()
+
+XenoUtil.setup_vfr_rules_for_vif( id, 0, ipaddr )
+
+if xc.domain_start( dom=id ):
+    print "Error starting domain"
+    xc.domain_destroy ( dom=id )
+    sys.exit()
diff --git a/tools/examples/destroydom.py b/tools/examples/destroydom.py
new file mode 100644 (file)
index 0000000..5bf6b76
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+
+#
+# Destroy specified domain.
+#
+
+import Xc, sys, re
+
+xc = Xc.new()
+
+if len(sys.argv) < 2:
+    print "Specify a domain identifier"
+    sys.exit()
+
+if (len(sys.argv) > 2) and re.match( 'force', sys.argv[2] ):
+    xc.domain_destroy( dom=int(sys.argv[1]), force=1 )
+else:
+    xc.domain_destroy( dom=int(sys.argv[1]), force=0 )
diff --git a/tools/examples/listdoms.py b/tools/examples/listdoms.py
new file mode 100644 (file)
index 0000000..0bc3d9b
--- /dev/null
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+
+#
+# List info on all domains.
+#
+
+import Xc, sys
+xc = Xc.new()
+print xc.domain_getinfo()
+
diff --git a/tools/examples/stopdom.py b/tools/examples/stopdom.py
new file mode 100644 (file)
index 0000000..aa20a97
--- /dev/null
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+
+#
+# Stop execution of specified domain.
+#
+
+import Xc, sys, re
+
+xc = Xc.new()
+
+if len(sys.argv) != 2:
+    print "Specify a domain identifier"
+    sys.exit()
+
+xc.domain_stop( dom=int(sys.argv[1]) )
diff --git a/tools/examples/xi_createlinuxdom.py b/tools/examples/xi_createlinuxdom.py
deleted file mode 100755 (executable)
index 2e25e30..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/env python
-
-#
-# Example script for creating and building a new Linux guest OS for Xen.
-#
-
-import Xc, XenoUtil, sys, os
-
-# Variable declaration. Set these up properly later on, as needed.
-nfsserv = nfspath = root_partn = usr_partn = ""
-
-# STEP 1. Specify kernel image file.
-image = "FULL_PATH_TO_IMAGE"
-
-# STEP 2. Specify IP address, netmask and gateway for the new domain.
-ipaddr  = "ADDRESS"
-netmask = XenoUtil.get_current_ipmask()
-gateway = XenoUtil.get_current_ipgw()
-
-# STEP 3a. Specify NFS server and path to rootfs (only needed for network boot)
-nfsserv = "ADDRESS"
-nfspath = "FULL_PATH_TO_ROOT_DIR"
-
-# STEP 3b. Specify root (and possibly /usr) on local disc (if not NFS booting)
-#root_partn = "/dev/sda2"
-#usr_partn  = "/dev/sda6"
-
-# STEP 4. Check that the following cmdline setup is to your taste.
-cmdline = "ip="+ipaddr+":"+nfsserv+":"+gateway+":"+netmask+"::eth0:off"
-if root_partn:
-    # Boot from local disc. May specify a separate /usr.
-    cmdline = cmdline + " root="+root_partn+" ro"
-    if usr_partn:
-        " usr="+usr_partn
-elif nfsserv:
-    # NFS boot
-    cmdline = cmdline + " root=/dev/nfs"
-    cmdline = cmdline + " nfsroot="+nfspath
-
-if root_partn:
-    root_info = XenoUtil.lookup_blkdev_partn_info(root_partn)
-    if not root_info:
-        print "Could not obtain info on partition '" + root_partn + "'"
-        sys.exit()
-
-if usr_partn:
-    usr_info = XenoUtil.lookup_blkdev_partn_info(usr_partn)
-    if not usr_info:
-        print "Could not obtain info on partition '" + usr_partn + "'"
-        sys.exit()
-
-if not os.path.isfile( image ):
-    print "Image file '" + image + "' does not exist"
-    sys.exit()
-
-xc = Xc.new()
-
-id = xc.domain_create()
-if id <= 0:
-    print "Error creating domain"
-    sys.exit()
-
-if xc.linux_build( dom=id, image=image, cmdline=cmdline ):
-    print "Error building Linux guest OS"
-    xc.domain_destroy ( dom=id )
-    sys.exit()
-
-if root_partn:
-    if xc.vbd_create( dom=id, vbd=root_info[0], writeable=1 ):
-        print "Error creating root VBD"
-        xc.domain_destroy ( dom=id )
-        sys.exit()
-    if xc.vbd_add_extent( dom=id,
-                          vbd=root_info[0],
-                          device=root_info[1],
-                          start_sector=root_info[2],
-                          nr_sectors=root_info[3] ):
-        print "Error populating root VBD"
-        xc.domain_destroy ( dom=id )
-        sys.exit()
-
-if usr_partn:
-    if xc.vbd_create( dom=id, vbd=usr_info[0], writeable=0 ):
-        print "Error creating usr VBD"
-        xc.domain_destroy ( dom=id )
-        sys.exit()
-    if xc.vbd_add_extent( dom=id,
-                          vbd=usr_info[0],
-                          device=usr_info[1],
-                          start_sector=usr_info[2],
-                          nr_sectors=usr_info[3] ):
-        print "Error populating usr VBD"
-        xc.domain_destroy ( dom=id )
-        sys.exit()
-
-XenoUtil.setup_vfr_rules_for_vif( id, 0, ipaddr )
-
-if xc.domain_start( dom=id ):
-    print "Error starting domain"
-    xc.domain_destroy ( dom=id )
-    sys.exit()
diff --git a/tools/examples/xi_destroydom.py b/tools/examples/xi_destroydom.py
deleted file mode 100644 (file)
index 5bf6b76..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/env python
-
-#
-# Destroy specified domain.
-#
-
-import Xc, sys, re
-
-xc = Xc.new()
-
-if len(sys.argv) < 2:
-    print "Specify a domain identifier"
-    sys.exit()
-
-if (len(sys.argv) > 2) and re.match( 'force', sys.argv[2] ):
-    xc.domain_destroy( dom=int(sys.argv[1]), force=1 )
-else:
-    xc.domain_destroy( dom=int(sys.argv[1]), force=0 )
diff --git a/tools/examples/xi_listdoms.py b/tools/examples/xi_listdoms.py
deleted file mode 100644 (file)
index 0bc3d9b..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env python
-
-#
-# List info on all domains.
-#
-
-import Xc, sys
-xc = Xc.new()
-print xc.domain_getinfo()
-
diff --git a/tools/examples/xi_stopdom.py b/tools/examples/xi_stopdom.py
deleted file mode 100644 (file)
index aa20a97..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env python
-
-#
-# Stop execution of specified domain.
-#
-
-import Xc, sys, re
-
-xc = Xc.new()
-
-if len(sys.argv) != 2:
-    print "Specify a domain identifier"
-    sys.exit()
-
-xc.domain_stop( dom=int(sys.argv[1]) )